-
Notifications
You must be signed in to change notification settings - Fork 201
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
#113 RsWithHeaders must reuse RsWithHeader #210
Conversation
@dmzaytsev Thanks, someone will review your pull request soon |
@pinaf it's yours,please review |
@@ -47,8 +48,8 @@ public void addsHeadersToResponse() throws IOException { | |||
new RsPrint( | |||
new RsWithHeaders( | |||
new RsEmpty(), | |||
"Host: www.example.com ", | |||
"Content-Type: text/xml " | |||
"Host: www.example.com", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dmzaytsev let's extract this into a private final String variable.
@dmzaytsev nice :) 3 minor comments above. |
@pinaf done :) |
@dmzaytsev thanks. this design is very "russian doll" style. |
@pinaf how would you solved this problem? |
@rultor merge |
@dmzaytsev I wouldn't reuse the |
@pinaf build failed .. weird |
@pinaf use of the |
@dmzaytsev only with java 8 on travis. seems like a network issue. |
@rultor merge |
@yegor256 this PR needs to be merged |
@yegor256 take a look this PR please |
@dmzaytsev this is a wrong design. I disagree with @pinaf here and even wrote an article about it. It will be published in a few days, but you can check the draft here: https://raw.githubusercontent.com/yegor256/blog/master/_drafts/ctors.md Constructors should be light and never (ideally) do anything except assignments. |
@yegor256 what do you mean exactly? I pointed out an opinion but his design was different. |
@yegor256 full composition with one object instance per element in iterable? |
@pinaf I'm talking about this comment you made: #210 (comment) |
@yegor256 yeah, I see - I agree with the article. However, you do note he chose the compositional style - kind of - instead of going with my opinion. |
@pinaf current implementation using |
@yegor256 ok - so the missing part is the delaying of the iteration, like you point out in the article. thanks! |
@yegor256 useful article, thanks! |
for (final CharSequence hdr: headers) { | ||
resp = new RsWithHeader(resp, hdr); | ||
} | ||
final List<String> ret = new ArrayList<String>(1); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't get this... why can't you just do return resp.head()
?
@dmzaytsev yes, better, but you over-engineered it, I believe. see my comment |
@yegor256 you're right |
@rultor try to merge |
@elenavolokhova review this ticket please, for compliance with our quality rules |
@dmzaytsev @pinaf here is the article published: http://www.yegor256.com/2015/05/07/ctors-must-be-code-free.html |
@davvd Looks good! |
@elenavolokhova thanks for the review and a good remark |
@pinaf I added 10 mins to @elenavolokhova (for QA review) in transaction 56872197... Thanks so much! Your account was topped up for 25 mins (transaction ID is |
@rultor deploy now pls |
For #113
Got rid code duplication in RsWithHeader and RsWithHeaders according the task description